Getting Started With the Unified API

The code snippet below illustrates the most basic API functions used for implementing licensing:

/*Sentinel RMS sample for basic licensing functions.*/
/*For implementation details, see the Unified API sample sntl_demo 
available inside the samples directory of Sentinel RMS installation.*/
  int main{
    int rc = SNTL_SUCCESS;
    /* Creating an attribute object for Application Context*/
    rc = sntl_licensing_attr_new(...);
    /* Setting the value in the attribute object*/
    rc = sntl_licensing_attr_set(...);
    /*Creating an Application Context */
    rc = sntl_licensing_app_context_new(...);
    /*Obtains a license authorization from the License Manager*/
    rc = sntl_licensing_login_attr(...);
    /*Renews the license authorization from the License Manager */
    rc = sntl_licensing_refresh_attr(...);
    /* Releases the license authorization associated with a login session*/
    rc = sntl_licensing_logout_attr(...);
    /*Deletes the Attribute object */
    sntl_licensing_attr_delete(..);
    /*Cleans the Licensing library*/
    sntl_licensing_cleanup();}

Creating the Attribute object

Create a new attribute object using sntl_licensing_attr_new in the attr output parameter. An attribute object is a collection of {key, value} pairs that defines an API function's additional input parameters. The available attributes keys are described in the relevant API description.

To define the {key, value} pairs, the sntl_licensing_attr_set is to be used.

Setting the Value in the Attribute Object

Sets a {key, value} pair in the attribute object. For example, SNTL_ATTR_APPCONTEXT_CONTACT_SERVER is the key and 'server name' is the value for setting the License Manager for on-premises network deployments.

Creating an Application Context

Creates the application context object using sntl_licensing_app_context_new with the specified attributes. An application context object contains the configuration settings that should be used by the licensing API calls made using that application context.

The function also initializes and allocates resources necessary for the RMS licensing library.

Obtaining a License Authorization from the License Manager

Use the sntl_licensing_login_attr API for obtaining a license authorization. This API also allows passing additional values for specific purposes. This API returns a session object for the login request. This object can be used for updating and releasing the license authorization.

Refreshing the License

Once a license authorization is obtained, use the sntl_licensing_refresh_attr API for renewing the license authorization by contacting the License Manager. This API requires the pointer to the session object returned by the corresponding login call. This API also allows passing additional values for specific purposes at the time of renewing the license authorization.

Releasing the License Authorization

Once the user has finished using the licensed feature/application, call sntl_licensing_logout_attr to release the license authorization associated with a login session. Once the user releases the license, it can be requested by other users.

Deleting the Attribute Object

After releasing the license authorization associated with a login session, call sntl_licensing_attr_delete API to delete attribute object.

Cleaning the Licensing Library

After all the licensing API calls are done, clean the licensing library using the sntl_licensing_cleanup API.